﻿using System;
using System.Reflection;

namespace Fuse8.DomainFramework.Common
{
	internal static class MemberInfoExtensions
	{
		public static Type GetMemberType(this MemberInfo member)
		{
			if (member is PropertyInfo)
			{
				return ((PropertyInfo) member).PropertyType;
			}
			if (member is FieldInfo)
			{
				return ((FieldInfo)member).FieldType;
			}
			throw new ArgumentOutOfRangeException("member");
		}
	}
}